$('document').ready(function () {
    $('#f').validate(
        {
            rules: {
                "j_username": {
                    required: true,
                    email: true
                },
                "j_password": {
                    required: true,
                    minlength: 5,
                    maxlength: 15
                },
                "j_confirm": {
                    equalTo: "#j_password"
                }
            },
            messages: {
                "j_username": {
                    required: "Input e-mail",
                    email: "Input valid e-mail"
                },
                "j_password": {
                    required: "Input password",
                    minlength: "Password must contain 5-15 symbols",
                    maxlength: "Password must contain 5-15 symbols"
                },
                "j_confirm": {
                    equalTo: "Passwords are not equal"
                }
            }
        })
})